package com.example.hospital_208.service.impl;

import com.example.hospital_208.dao.NoticeDao;
import com.example.hospital_208.po.Notice;
import com.example.hospital_208.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {

    @Autowired
    private NoticeDao noticeDao;

    @Override
    public List<Notice> findAll() {
        return noticeDao.findAll();
    }

    @Override
    public Notice findById(Integer id) {
        return noticeDao.findById(id);
    }

    @Override
    public List<Notice> findByDay(String day) {
        return noticeDao.findByDay(day);
    }

    @Override
    @Transactional
    public int insert(Notice notice) {
        return noticeDao.insert(notice);
    }

    @Override
    @Transactional
    public int update(Notice notice) {
        return noticeDao.update(notice);
    }

    @Override
    @Transactional
    public int delete(Integer id) {
        return noticeDao.delete(id);
    }
}